package top.glike.funct.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import top.glike.common.annotation.Log;
import top.glike.common.core.controller.BaseController;
import top.glike.common.core.domain.AjaxResult;
import top.glike.common.enums.BusinessType;
import top.glike.funct.domain.GbProanalysis;
import top.glike.funct.service.IGbProanalysisService;
import top.glike.common.utils.poi.ExcelUtil;
import top.glike.common.core.page.TableDataInfo;

/**
 * 项目组管理Controller
 * 
 * @author Sophia
 * @date 2024-02-13
 */
@RestController
@RequestMapping("/funct/proanalysis")
public class GbProanalysisController extends BaseController
{
    @Autowired
    private IGbProanalysisService gbProanalysisService;

    /**
     * 查询项目组管理列表
     */
    // @PreAuthorize("@ss.hasPermi('funct:proanalysis:list')")
    @GetMapping("/list")
    public TableDataInfo list(GbProanalysis gbProanalysis)
    {
        startPage();
        List<GbProanalysis> list = gbProanalysisService.selectGbProanalysisList(gbProanalysis);
        return getDataTable(list);
    }

    /**
     * 导出项目组管理列表
     */
    // @PreAuthorize("@ss.hasPermi('funct:proanalysis:export')")
    @Log(title = "项目组管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, GbProanalysis gbProanalysis)
    {
        List<GbProanalysis> list = gbProanalysisService.selectGbProanalysisList(gbProanalysis);
        ExcelUtil<GbProanalysis> util = new ExcelUtil<GbProanalysis>(GbProanalysis.class);
        util.exportExcel(response, list, "项目组管理数据");
    }

    /**
     * 获取项目组管理详细信息
     */
    // @PreAuthorize("@ss.hasPermi('funct:proanalysis:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") String id)
    {
        return success(gbProanalysisService.selectGbProanalysisById(id));
    }

    /**
     * 新增项目组管理
     */
    // @PreAuthorize("@ss.hasPermi('funct:proanalysis:add')")
    @Log(title = "项目组管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody GbProanalysis gbProanalysis)
    {
        return toAjax(gbProanalysisService.insertGbProanalysis(gbProanalysis));
    }

    /**
     * 修改项目组管理
     */
    // @PreAuthorize("@ss.hasPermi('funct:proanalysis:edit')")
    @Log(title = "项目组管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody GbProanalysis gbProanalysis)
    {
        return toAjax(gbProanalysisService.updateGbProanalysis(gbProanalysis));
    }

    /**
     * 删除项目组管理
     */
    // @PreAuthorize("@ss.hasPermi('funct:proanalysis:remove')")
    @Log(title = "项目组管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable String[] ids)
    {
        return toAjax(gbProanalysisService.deleteGbProanalysisByIds(ids));
    }
}
